<template>
	<view class="newsBox">
		<view class="pic">
			<image :src="item.picurl" mode="aspectFill"></image>
		</view>
		<view class="text">
			<view class="title">{{item.title}}</view>
			<view class="info" v-if="!item.looktime">
				<text>{{item.author}}</text>
				<text>{{item.hits}}浏览量</text>
			</view>
			<view class="info" v-else>
				<text>{{item.looktime}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"newsBox",
		props:{
			item:{
				type:Object,
				default(){
					return {
						title:"组件默认标题",
						author:"里斯",
						hits:"668",
						picurl:"../../static/images/1.jpg",
					}
				}
			}
		},
		data() {
			return {
				
			};
		}
	}
</script>

<style lang="scss">
	.newsBox{
		display: flex;
		.pic{
			width:230rpx;
			height:160rpx;
			image{
				width:100%;
				height:100%;
			}
		}
		.text{
			flex:1;
			padding-left: 20rpx;
			display: flex;
			flex-direction:column;
			justify-content: space-between;
			
			.title{
				font-size: 32rpx;
				color:#333;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
			}
			.info{
				font-size: 24rpx;
				color: #999;
				text{
					padding-right:30rpx;
				}
			}
		}
	}

	
</style>